]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: honor lock-delay GSettings key
authorGiovanni Campagna <gcampagna@src.gnome.org>
Tue, 25 Dec 2012 00:13:52 +0000 (01:13 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 27 Dec 2012 18:05:44 +0000 (19:05 +0100)
org.gnome.desktop.screensaver.lock-delay contains the grace period
of the screensaver: if deactivated within that many seconds from the
start of the idle period, the shell should not prompt for a password.
This setting correspond to the "Lock screen after" combo in screen
and privacy panels.

https://bugzilla.gnome.org/show_bug.cgi?id=690766

js/ui/screenShield.js

index 917be7c8f5b4e326386338601201e3828cf2d733..3ee24ebbc533fe9abf02e46229e7ce47fc98f97a 100644 (file)
@@ -25,6 +25,7 @@ const Util = imports.misc.util;
 
 const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
 const LOCK_ENABLED_KEY = 'lock-enabled';
+const LOCK_DELAY_KEY = 'lock-delay';
 
 const CURTAIN_SLIDE_TIME = 0.3;
 // fraction of screen height the arrow must reach before completing
@@ -636,7 +637,11 @@ const ScreenShield = new Lang.Class({
                 let lightboxWasShown = this._lightbox.shown;
                 this._lightbox.hide();
 
-                let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
+                // GLib.get_monotonic_time() returns microseconds, convert to seconds
+                let elapsedTime = (GLib.get_monotonic_time() - this._activationTime) / 1000000;
+                let shouldLock = lightboxWasShown &&
+                    this._settings.get_boolean(LOCK_ENABLED_KEY) &&
+                    (elapsedTime >= this._settings.get_boolean(LOCK_DELAY_KEY));
                 if (shouldLock || this._isLocked) {
                     this.lock(false);
                 } else if (this._isActive) {